<template>
  <div class="referinput-component">

    <div class="input-list">
      <div class="input">
        <input v-model.lazy="name" class="normaltext" v-model="btjrxm1" type="text" placeholder="被举荐人姓名">
        <div class="is-must normaltext">*</div>
      </div>

      <div class="input">
        <input class="normaltext" type="number" v-model="btjrdh1" placeholder="被举荐人电话">
        <div class="is-must normaltext">*</div>
      </div>

      <div class="input">
        <input class="normaltext" type="text" v-model="title" placeholder="推荐企业">
        <div class="is-must normaltext">*</div>
      </div>

      <div class="input">
        <input class="normaltext" type="text" v-model="tjrxm1" placeholder="举荐人姓名">
        <div class="is-must normaltext">*</div>
      </div>

      <div class="input">
        <input class="normaltext" type="number" v-model="tjrdh1" placeholder="举荐人电话">
        <div class="is-must normaltext">*</div>
      </div>

      <div class="input">
        <button class="submit-btn normaltext" @click="formSubmit">确认提交</button>
        <div class="is-must normaltext"></div>
      </div>

    </div>


  </div>
</template>
<script>
 const wxapp = getApp()
  export default {
    data(){
      return{
        title:'',
        tjrdh1:'',
        tjrxm1:'',
        btjrdh1:'',
        btjrxm1:''
      }
    },
    components:{
      // Xinput
    },
    methods: {
      formSubmit: function(e) {
        if(this.tjrdh1=='' || this.tjrxm1=='' || this.btjrdh1=='' || this.btjrxm1=='')
        {
          wx.showToast({
            title: '必须填写.',
            icon: 'success',
            duration: 2000
          })
          return false
        }

        if(this.title=='')
        {
          wx.showToast({
            title: '企业必须填写.',
            icon: 'success',
            duration: 2000
          })
          return false
        }
        wx.showLoading({
  title: '加载中',
})
        wx.request({
          url: wxapp.globalData.ROOT_URL, //仅为示例，并非真实的接口地址
          data: {
             service: 'App.Hong.FormData',
             table: '4_form_hytj',
             data: {
               tjrdh1: this.tjrdh1, tjrxm1: this.tjrxm1, title: this.title, btjrdh: this.btjrdh1, btjrxm: this.btjrxm1
             },
             stieid: 4
          },
          header: {
              'content-type': 'application/json' // 默认值
          },
          success: function(res) {
            wx.hideLoading()
            if(res.data.data.result > 0 ) {
              wx.showToast({
                title: '报名成功.',
                icon: 'success',
                duration: 2000
              })
            }else {
              wx.showToast({
                title: '报名失败.',
                icon: 'success',
                duration: 2000
              })
            }
          }
        })
      },
    }
  }
</script>
<style scoped>
.referinput-component{
  padding: 50rpx;
  width: 100%;
}
.input{
  margin: 20rpx 0;
}
.input-list input{
  border: 1rpx solid #000;
  height: 50rpx;

}
.input{
  display: flex;
  flex-direction: row;
}
.input input,.input .is-must{
  display: flex;
}
.input input{
  flex: 1;
  padding: 10rpx;
}
.input .is-must{
  width: 20rpx;
  padding-left: 15rpx;
  color: #E9161F;
  line-height: 75rpx;
}
  .submit-btn{
    width: 100%;
    color: #fff;
    background: #2197D8;
  }
</style>
